// PHSDirectorySetting.cpp: implementation of the PHSDirectorySetting class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "PHSDirectorySetting.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

IMPLEMENT_SINGLETON(PHSDirectorySetting);

PHSDirectorySetting& GetCurDirectorySetting()
{
	return *PHSDirectorySetting::Instance();
}

PHSDirectorySetting::PHSDirectorySetting()
{
	m_strPrjTemplateDir = _T("\\\\system\\D\\PHSModeler\\Template\\");
	m_strCrudeDBDir = _T("\\\\system\\D\\PHSModeler\\CrudeData\\");
	m_strDefaultPrjDir = _T("D:\\PHSModelerTest\\Project\\");
	m_strMenuDir = _T("\\\\system\\D\\PHSModeler\\menu\\");
	m_strSpecDir = _T("\\\\system\\D\\PHSModeler\\Template\\");
}

PHSDirectorySetting::~PHSDirectorySetting()
{

}

BOOL PHSDirectorySetting::InitSetting()
{
//	m_strPrjDBDir = PHSRegEdit().GetRegKey(_T("Directory"), _T("EDinBox_PrjDBdir"), CString());
//	m_strPrjDir = PHSRegEdit().GetRegKey(_T("Directory"), _T("EDinBox_Prjdir"), CString());
#ifndef _ARXDEBUG
	m_strPrjTemplateDir = PHSRegEdit().GetRegKey(_T("Directory"), _T("EDinBox_SMTemplateDir"), CString());
	m_strCrudeDBDir = PHSRegEdit().GetRegKey(_T("Directory"), _T("EDinBox_CrudeDBDir"), CString());
	m_strDefaultPrjDir = PHSRegEdit().GetRegKey(_T("Directory"), _T("EDinBox_DefaultPrjDir"), CString());
	m_strMenuDir = PHSRegEdit().GetRegKey(_T("Directory"), _T("EDinBox_MenuDir"), CString());
	m_strSpecDir = PHSRegEdit().GetRegKey(_T("Directory"), _T("EDinBox_SpecDir"), CString());
	
	if(m_strSpecDir.IsEmpty() ||
		m_strPrjTemplateDir.IsEmpty() ||
		m_strCrudeDBDir.IsEmpty() ||
		m_strDefaultPrjDir.IsEmpty() ||
		m_strMenuDir.IsEmpty() ||
		m_strSpecDir.IsEmpty())
		return FALSE;
#endif
	return TRUE;
}

BOOL PHSDirectorySetting::SaveSetting()
{
//	PHSRegEdit().SetRegValue(_T("Directory"), _T("EDinBox_PrjDBdir"), m_strPrjDBDir);
//	PHSRegEdit().SetRegValue(_T("Directory"), _T("EDinBox_Prjdir"), m_strPrjDir);
	return TRUE;
}
